package com.ydj.app.entity;

import com.ydj.framework.mysql.BaseEntity;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

import javax.persistence.*;

@Getter
@Setter
@Entity
@Accessors(chain = true)
@Table(name = "kol",
        indexes = {@Index(name = "idx_account", columnList = "account")},
        uniqueConstraints = {@UniqueConstraint(name = "uni_account", columnNames = {"account"})})
@org.hibernate.annotations.Table(appliesTo = "kol", comment = "KOL")
public class Kol extends BaseEntity {
    @Column(columnDefinition = "varchar(50) comment '名字'")
    private String name;

    @Column(columnDefinition = "varchar(50) comment '链接的账号'")
    private String account;

    @Column(columnDefinition = "int default 0 comment '总邀请人数'")
    private Integer totalInviteCount;

    @Column(columnDefinition = "int default 0 comment '已结算人数'")
    private Integer totalSettledCount;

    @Column(columnDefinition = "int default 0 comment '未结算人数'")
    private Integer totalUnsettledCount;

    public Kol incInvite() {
        this.totalInviteCount++;
        this.totalUnsettledCount++;
        return this;
    }
}